home *** CD-ROM | disk | FTP | other *** search
/ Beginning Mac Programming / Beginning Mac Programming.bin / pc / Open Me for REALbasic 3 / REALbasic 3.2 / Example Projects / Techniques / Char Set & String Stuff / CharSet source code / Glue Code / PluginMain.cpp next >
Encoding:
Text File  |  2000-07-18  |  43.4 KB  |  1,188 lines

  1. // rb_plugin.h
  2. //
  3. //    This file is part of the REALbasic plugin API.
  4. //
  5. // © 1997-2000 REAL Software Inc. -- All Rights Reserved
  6.  
  7. #include "REALplugin.h"
  8. #ifndef WIN32
  9.  #if !CARBON    // May 03 2000 -- GCC (1)
  10.      #include <A4Stuff.h>
  11.      #include <SetupA4.h>
  12.  #endif            // May 03 2000 -- GCC (1)
  13. #endif
  14. #include "rb_plugin.h"
  15.  
  16. #ifndef WIN32
  17. #ifndef powerc
  18. #define USECALLSHELL
  19. #endif
  20. #endif
  21.  
  22. static void *(*gResolver)(const char *entryName);
  23.  
  24. #ifdef powerc
  25. static void *(*gResolverPPC)(const char *entryName);
  26. #endif
  27.  
  28. // static Ptr *gA4Stack;
  29. static unsigned long a4stack;
  30.  
  31. #ifdef powerc
  32. int __procinfo = kThinkCStackBased | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(4));
  33. #endif
  34.  
  35. #ifdef powerc
  36. //#define CallResolver(a) CallUniversalProc((RoutineDescriptor *) gResolver, kThinkCStackBased | RESULT_SIZE(SIZE_CODE(4)) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(4)), a)
  37. //#define Caller(func, upp) CallUniversalProc((RoutineDescriptor *) func, upp, 
  38. #define CallResolver(a) gResolverPPC(a)
  39. #else
  40. #define CallResolver(a) gResolver(a)
  41. #endif
  42.  
  43. #ifdef USECALLSHELL
  44. static REALproc buildEnvironmentShell(void *func)
  45. {
  46.     short *glue;
  47.     REALproc proc;
  48.     unsigned long originalCode;
  49.     unsigned long unglue;
  50.     unsigned long pluginA4 = GetCurrentA4();
  51.  
  52.     static int gRemainAllocCount;
  53.     static Ptr gRemainAllocPtr;
  54.  
  55.     if (!func)
  56.         return nil;
  57.     if (func == REALstandardGetter)
  58.         return REALstandardGetter;
  59.  
  60.     originalCode = (unsigned long) func;
  61.     if (!gRemainAllocCount)
  62.     {
  63.         gRemainAllocCount = 8;
  64.         gRemainAllocPtr = NewPtr(8 * 52);
  65.     }
  66.     
  67.     glue = (short *) gRemainAllocPtr;
  68.     gRemainAllocPtr += 52;
  69.     gRemainAllocCount--;
  70.     proc = (REALproc) glue;
  71.  
  72.     unglue = (unsigned long) (glue + 17);
  73.  
  74.     *glue++ = 0x2079; // movea.l $, A0
  75.     *glue++ = a4stack >> 16;
  76.     *glue++ = a4stack & 0xffff;
  77.     *glue++ = 0x210c; // move.l A4, -(A0)
  78.     *glue++ = 0x211f; // move.l (A7)+, -(A0)
  79.     *glue++ = 0x287c; // move.l #, A4
  80.     *glue++ = pluginA4 >> 16;
  81.     *glue++ = pluginA4 & 0xffff;
  82.     *glue++ = 0x2f3c; // move.l #, -(A7)
  83.     *glue++ = unglue >> 16;
  84.     *glue++ = unglue & 0xffff;
  85.     *glue++ = 0x23c8; // move.l A0, $
  86.     *glue++ = a4stack >> 16;
  87.     *glue++ = a4stack & 0xffff;
  88.     *glue++ = 0x4ef9; // jmp $
  89.     *glue++ = originalCode >> 16;
  90.     *glue++ = originalCode & 0xffff;
  91.  
  92.     *glue++ = 0x2279; // movea.l $, A1
  93.     *glue++ = a4stack >> 16;
  94.     *glue++ = a4stack & 0xffff;
  95.     *glue++ = 0x2f19; // move.l (A1)+,-(A7)
  96.     *glue++ = 0x2859; // movea.l (A1)+, A4
  97.     *glue++ = 0x23c9; // move.l A1, $
  98.     *glue++ = a4stack >> 16;
  99.     *glue++ = a4stack & 0xffff;
  100.     *glue++ = 0x4e75; // rts
  101.  
  102.     return proc;
  103. }
  104. #endif
  105.  
  106. #pragma mark -
  107. #pragma mark PAM Code Below!
  108. #pragma mark -
  109. // **** Autogenerated code from Plugin API Manager follows ****
  110. // *************** Do not edit below this line ****************
  111.  
  112. #if TARGET_68K || TARGET_PPC
  113. QDGlobals *REALQDGlobals(void)
  114. {
  115.     static unsigned long (*pQDGlobals)(void) = nil;
  116.     if (!pQDGlobals)
  117.         pQDGlobals = (unsigned long (*)(void)) CallResolver("REALQDGlobals");
  118.     if (pQDGlobals) return (QDGlobals *)pQDGlobals();
  119.     else return (QDGlobals *)0;
  120. }
  121. #endif
  122.  
  123. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  124. int REALallocateMenuID(void)
  125. {
  126.     static int (*pAllocateMenuID)(void) = nil;
  127.     if (!pAllocateMenuID)
  128.         pAllocateMenuID = (int (*)(void)) CallResolver("allocateMenuID");
  129.     if (pAllocateMenuID) return pAllocateMenuID();
  130.     else return (int)0;
  131. }
  132. #endif
  133.  
  134. Boolean REALinRuntime(void)
  135. {
  136.     static Boolean (*pInRuntime)(void) = nil;
  137.     if (!pInRuntime)
  138.         pInRuntime = (Boolean (*)(void)) CallResolver("REALinRuntime");
  139.     if (pInRuntime) return pInRuntime();
  140.     else return (Boolean)0;
  141. }
  142.  
  143. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  144. void REALreleaseMenuID(int id)
  145. {
  146.     static void (*pReleaseMenuID)(int) = nil;
  147.     if (!pReleaseMenuID)
  148.         pReleaseMenuID = (void (*)(int)) CallResolver("releaseMenuID");
  149.     if (pReleaseMenuID) pReleaseMenuID(id);
  150. }
  151. #endif
  152.  
  153. void GraphicsDrawLine(REALgraphics graphicsObject, int x1, int y1, int x2, int y2)
  154. {
  155.     static void (*pGraphicsDrawLine)(REALgraphics, int, int, int, int) = nil;
  156.     if (!pGraphicsDrawLine)
  157.         pGraphicsDrawLine = (void (*)(REALgraphics, int, int, int, int)) CallResolver("RuntimeGraphicsDrawLine");
  158.     if (pGraphicsDrawLine) pGraphicsDrawLine(graphicsObject, x1, y1, x2, y2);
  159. }
  160.  
  161. void REALRegisterMethod(REALmethodDefinition *defn)
  162. {
  163.     static void (*pRuntimeRegisterMethod)(REALmethodDefinition *defn);
  164.     if (!pRuntimeRegisterMethod)
  165.         pRuntimeRegisterMethod = (void (*)(REALmethodDefinition *)) CallResolver("PluginRegisterMethod");
  166.     #ifdef USECALLSHELL
  167.     defn->function = buildEnvironmentShell(defn->function);
  168.     defn->setterFunction = buildEnvironmentShell(defn->setterFunction);
  169.     #endif
  170.     pRuntimeRegisterMethod(defn);
  171. }
  172.  
  173. void REALRegisterControl(REALcontrol *defn)
  174. {
  175.     static void (*pRuntimeRegisterControl)(REALcontrol *defn);
  176.     if (!pRuntimeRegisterControl)
  177.         pRuntimeRegisterControl = (void (*)(REALcontrol *)) CallResolver("PluginRegisterControl");
  178.     #ifdef USECALLSHELL
  179.     int i;
  180.     for (i = 0; i < defn->propertyCount; i++)
  181.     {
  182.         defn->properties[i].getter = buildEnvironmentShell(defn->properties[i].getter);
  183.         defn->properties[i].setter = buildEnvironmentShell(defn->properties[i].setter);
  184.     }
  185.     for (i = 0; i < defn->methodCount; i++)
  186.     {
  187.         defn->methods[i].function = buildEnvironmentShell(defn->methods[i].function);
  188.         defn->methods[i].setterFunction = buildEnvironmentShell(defn->methods[i].setterFunction);
  189.     }
  190.     defn->behaviour->constructorFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->constructorFunction);
  191.     defn->behaviour->destructorFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->destructorFunction);
  192.     defn->behaviour->redrawFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->redrawFunction);
  193.     defn->behaviour->clickFunction = (Boolean (*)(REALcontrolInstance, int, int, int)) buildEnvironmentShell(defn->behaviour->clickFunction);
  194.     defn->behaviour->mouseDragFunction = (void (*)(REALcontrolInstance, int, int)) buildEnvironmentShell(defn->behaviour->mouseDragFunction);
  195.     defn->behaviour->mouseUpFunction = (void (*)(REALcontrolInstance, int, int)) buildEnvironmentShell(defn->behaviour->mouseUpFunction);
  196.     defn->behaviour->gainedFocusFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->gainedFocusFunction);
  197.     defn->behaviour->lostFocusFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->lostFocusFunction);
  198.     defn->behaviour->keyDownFunction = buildEnvironmentShell(defn->behaviour->keyDownFunction);
  199.     defn->behaviour->openFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->openFunction);
  200.     defn->behaviour->closeFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->closeFunction);
  201.     defn->behaviour->backgroundIdleFunction = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->backgroundIdleFunction);
  202.     defn->behaviour->drawOffscreenFunction = (void (*)(REALcontrolInstance, REALgraphics)) buildEnvironmentShell(defn->behaviour->drawOffscreenFunction);
  203.     defn->behaviour->setSpecialBackground = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->setSpecialBackground);
  204.     defn->behaviour->constantChanging = (void (*)(REALcontrolInstance, REALstring)) buildEnvironmentShell(defn->behaviour->constantChanging);
  205.     defn->behaviour->droppedNewInstance = (void (*)(REALcontrolInstance)) buildEnvironmentShell(defn->behaviour->droppedNewInstance);
  206.     #endif
  207.     pRuntimeRegisterControl(defn);
  208. }
  209.  
  210. void REALRegisterClassExtension(REALclassDefinition *defn)
  211. {
  212.     static void (*pRegisterClassExtension)(REALclassDefinition *defn);
  213.     if (!pRegisterClassExtension)
  214.         pRegisterClassExtension = (void (*)(REALclassDefinition *)) CallResolver("PluginRegisterClassExtension");
  215.     #ifdef USECALLSHELL
  216.     int i;
  217.     for (i = 0; i < defn->propertyCount; i++)
  218.     {
  219.         defn->properties[i].getter = buildEnvironmentShell(defn->properties[i].getter);
  220.         defn->properties[i].setter = buildEnvironmentShell(defn->properties[i].setter);
  221.     }
  222.     for (i = 0; i < defn->methodCount; i++)
  223.     {
  224.         defn->methods[i].function = buildEnvironmentShell(defn->methods[i].function);
  225.         defn->methods[i].setterFunction = buildEnvironmentShell(defn->methods[i].setterFunction);
  226.     }
  227.     #endif
  228.     if (pRegisterClassExtension)
  229.         pRegisterClassExtension(defn);
  230. }
  231.  
  232. void REALRegisterDBEngine(REALdbEngineDefinition *defn)
  233. {
  234.     static void (*pRegisterDatabaseEngine)(REALdbEngineDefinition *defn);
  235.     if (!pRegisterDatabaseEngine)
  236.         pRegisterDatabaseEngine = (void (*)(REALdbEngineDefinition *)) CallResolver("PluginRegisterDBEngine");
  237.     #ifdef USECALLSHELL
  238.     defn->closeDatabase = (void (*)(dbDatabase *)) buildEnvironmentShell(defn->closeDatabase);
  239.     defn->getTableSchemaCursor = (REALdbCursor (*)(dbDatabase *)) buildEnvironmentShell(defn->getTableSchemaCursor);
  240.     defn->getFieldSchemaCursor = (REALdbCursor (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->getFieldSchemaCursor);
  241.     defn->directSQLSelect = (REALdbCursor (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->directSQLSelect);
  242.     defn->directSQLExecute = (void (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->directSQLExecute);
  243.     defn->createTable = (void (*)(dbDatabase *, REALstring, REALnewColumn *, unsigned char *, int)) buildEnvironmentShell(defn->createTable);
  244.     defn->addTableRecord = (void (*)(dbDatabase *, REALstring, REALcolumnValue *)) buildEnvironmentShell(defn->addTableRecord);
  245.     defn->getTableCursor = (REALdbCursor (*)(dbDatabase *, REALstring, REALgetColumn *, REALcolumnConstraints *)) buildEnvironmentShell(defn->getTableCursor);
  246.     defn->updateFields = (void (*)(dbDatabase *, REALfieldUpdate *)) buildEnvironmentShell(defn->updateFields);
  247.     defn->addTableColumn = (void (*)(dbDatabase *, REALstring, REALnewColumn *)) buildEnvironmentShell(defn->addTableColumn);
  248.     defn->getDatabaseIndexes = (REALdbCursor (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->getDatabaseIndexes);
  249.     defn->getLastErrorCode = (long (*)(dbDatabase *)) buildEnvironmentShell(defn->getLastErrorCode);
  250.     defn->getLastErrorString = (REALstring (*)(dbDatabase *)) buildEnvironmentShell(defn->getLastErrorString);
  251.     defn->commit = (void (*)(dbDatabase *)) buildEnvironmentShell(defn->commit);
  252.     defn->rollback = (void (*)(dbDatabase *)) buildEnvironmentShell(defn->rollback);
  253.     defn->getProperty = (REALstring (*)(dbDatabase *, REALstring)) buildEnvironmentShell(defn->getProperty);
  254.     #endif
  255.     if (pRegisterDatabaseEngine)
  256.         pRegisterDatabaseEngine(defn);
  257. }
  258.  
  259. void REALRegisterDBTable(REALdbTableDefinition *defn)
  260. {
  261.     static void (*pRegisterDBTable)(REALdbTableDefinition *defn);
  262.     if (!pRegisterDBTable)
  263.         pRegisterDBTable = (void (*)(REALdbTableDefinition *)) CallResolver("PluginRegisterDBTable");
  264.     if (pRegisterDBTable)
  265.         pRegisterDBTable(defn);
  266. }
  267.  
  268. void REALRegisterDBCursor(REALdbCursorDefinition *defn)
  269. {
  270.     static void (*pRegisterDBCursor)(REALdbCursorDefinition *defn);
  271.     if (!pRegisterDBCursor)
  272.         pRegisterDBCursor = (void (*)(REALdbCursorDefinition *)) CallResolver("PluginRegisterDBCursor");
  273.     #ifdef USECALLSHELL
  274.     defn->closeCursor = (void (*)(dbCursor *)) buildEnvironmentShell(defn->closeCursor);
  275.     defn->cursorColumnCount = (int (*)(dbCursor *)) buildEnvironmentShell(defn->cursorColumnCount);
  276.     defn->cursorColumnName = (REALstring (*)(dbCursor *, int column)) buildEnvironmentShell(defn->cursorColumnName);
  277.     defn->cursorRowCount = (int (*)(dbCursor *)) buildEnvironmentShell(defn->cursorRowCount);
  278.     defn->cursorColumnValue = (void (*)(dbCursor *, int, Ptr *, dbFieldType *, int *)) buildEnvironmentShell(defn->cursorColumnValue);
  279.     defn->cursorReleaseValue = (void (*)(dbCursor *)) buildEnvironmentShell(defn->cursorReleaseValue);
  280.     defn->cursorNextRow = (Boolean (*)(dbCursor *)) buildEnvironmentShell(defn->cursorNextRow);
  281.     defn->cursorDelete = (void (*)(dbCursor *)) buildEnvironmentShell(defn->cursorDelete);
  282.     defn->cursorDeleteAll = (void (*)(dbCursor *)) buildEnvironmentShell(defn->cursorDeleteAll);
  283.     #endif
  284.     if (pRegisterDBCursor)
  285.         pRegisterDBCursor(defn);
  286. }
  287.  
  288. void REALRegisterClass(REALclassDefinition *defn)
  289. {
  290.     static void (*pRegisterClass)(REALclassDefinition *defn);
  291.     if (!pRegisterClass)
  292.         pRegisterClass = (void (*)(REALclassDefinition *)) CallResolver("PluginRegisterClass");
  293.     #ifdef USECALLSHELL
  294.     int i;
  295.     defn->constructor = buildEnvironmentShell(defn->constructor);
  296.     defn->destructor = buildEnvironmentShell(defn->destructor);
  297.     for (i = 0; i < defn->propertyCount; i++)
  298.     {
  299.         defn->properties[i].getter = buildEnvironmentShell(defn->properties[i].getter);
  300.         defn->properties[i].setter = buildEnvironmentShell(defn->properties[i].setter);
  301.     }
  302.     for (i = 0; i < defn->methodCount; i++)
  303.     {
  304.         defn->methods[i].function = buildEnvironmentShell(defn->methods[i].function);
  305.         defn->methods[i].setterFunction = buildEnvironmentShell(defn->methods[i].setterFunction);
  306.     }
  307.     for (i = 0; i < defn->eventInstanceCount; i++)
  308.         defn->eventInstances[i].implementation = buildEnvironmentShell(defn->eventInstances[i].implementation);
  309.     #endif
  310.     if (pRegisterClass)
  311.         pRegisterClass(defn);
  312. }
  313.  
  314. const char *REALCString(REALstring str)
  315. {
  316.     static unsigned long (*pCString)(REALstring) = nil;
  317.     if (!pCString)
  318.         pCString = (unsigned long (*)(REALstring)) CallResolver("StringGetCString");
  319.     if (pCString) return (const char *)pCString(str);
  320.     else return (const char *)0;
  321. }
  322.  
  323. const unsigned char *REALPString(REALstring str)
  324. {
  325.     static unsigned long (*pPString)(REALstring) = nil;
  326.     if (!pPString)
  327.         pPString = (unsigned long (*)(REALstring)) CallResolver("StringGetPString");
  328.     if (pPString) return (const unsigned char *)pPString(str);
  329.     else return (const unsigned char *)0;
  330. }
  331.  
  332. REALstring REALInterpretConstantValue(REALstring value)
  333. {
  334.     static REALstring (*pInterpretConstantValue)(REALstring);
  335.     if (!pInterpretConstantValue)
  336.         pInterpretConstantValue = (REALstring (*)(REALstring)) CallResolver("PluginInterpretConstantValue");
  337.     if (!pInterpretConstantValue)
  338.     {
  339.         REALLockString(value);
  340.         return value;
  341.     }
  342.     return pInterpretConstantValue(value);
  343. }
  344.  
  345. REALstring REALDefaultControlFont(void)
  346. {
  347.     static unsigned long (*pDefaultControlFont)(void) = nil;
  348.     if (!pDefaultControlFont)
  349.         pDefaultControlFont = (unsigned long (*)(void)) CallResolver("PluginDefaultControlFont");
  350.     if (pDefaultControlFont) return (REALstring)pDefaultControlFont();
  351.     else return (REALstring)0;
  352. }
  353.  
  354. REALstring REALDefaultControlCaption(void)
  355. {
  356.     static unsigned long (*pDefaultControlCaption)(void) = nil;
  357.     if (!pDefaultControlCaption)
  358.         pDefaultControlCaption = (unsigned long (*)(void)) CallResolver("PluginDefaultControlCaption");
  359.     if (pDefaultControlCaption) return (REALstring)pDefaultControlCaption();
  360.     else return (REALstring)0;
  361. }
  362.  
  363. unsigned long REALDefaultControlFontSize(void)
  364. {
  365.     static unsigned long (*pDefaultControlFontSize)(void) = nil;
  366.     if (!pDefaultControlFontSize)
  367.         pDefaultControlFontSize = (unsigned long (*)(void)) CallResolver("PluginDefaultControlFontSize");
  368.     if (pDefaultControlFontSize) return pDefaultControlFontSize();
  369.     else return (unsigned long)0;
  370. }
  371.  
  372. REALstring REALBuildString(const char *contents, int length)
  373. {
  374.     static unsigned long (*pBuildString)(const char *, int) = nil;
  375.     if (!pBuildString)
  376.         pBuildString = (unsigned long (*)(const char *, int)) CallResolver("REALBuildString");
  377.     if (pBuildString) return (REALstring)pBuildString(contents, length);
  378.     else return (REALstring)0;
  379. }
  380.  
  381. void REALLockObject(REALobject obj)
  382. {
  383.     static void (*pLockObject)(REALobject) = nil;
  384.     if (!pLockObject)
  385.         pLockObject = (void (*)(REALobject)) CallResolver("REALLockObject");
  386.     if (pLockObject) pLockObject(obj);
  387. }
  388.  
  389. void REALUnlockObject(REALobject obj)
  390. {
  391.     static void (*pUnlockObject)(REALobject) = nil;
  392.     if (!pUnlockObject)
  393.         pUnlockObject = (void (*)(REALobject)) CallResolver("REALUnlockObject");
  394.     if (pUnlockObject) pUnlockObject(obj);
  395. }
  396.  
  397. void REALLockString(REALstring str)
  398. {
  399.     static void (*pLockString)(REALstring) = nil;
  400.     if (!pLockString)
  401.         pLockString = (void (*)(REALstring)) CallResolver("REALLockString");
  402.     if (pLockString) pLockString(str);
  403. }
  404.  
  405. void REALUnlockString(REALstring str)
  406. {
  407.     static void (*pUnlockString)(REALstring) = nil;
  408.     if (!pUnlockString)
  409.         pUnlockString = (void (*)(REALstring)) CallResolver("REALUnlockString");
  410.     if (pUnlockString) pUnlockString(str);
  411. }
  412.  
  413. REALproc REALInterfaceRoutine(REALobject obj, const char *interfaceName, const char *methodName)
  414. {
  415.     static unsigned long (*pInterfaceRoutine)(REALobject, const char *, const char *) = nil;
  416.     if (!pInterfaceRoutine)
  417.         pInterfaceRoutine = (unsigned long (*)(REALobject, const char *, const char *)) CallResolver("GetInterfaceRoutine");
  418.     if (pInterfaceRoutine) return (REALproc)pInterfaceRoutine(obj, interfaceName, methodName);
  419.     else return (REALproc)0;
  420. }
  421.  
  422. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  423. REALpicture REALBuildPictureFromPicHandle(PicHandle pic, Boolean bPassOwnership)
  424. {
  425.     static unsigned long (*pBuildPictureFromPicHandle)(PicHandle, Boolean) = nil;
  426.     if (!pBuildPictureFromPicHandle)
  427.         pBuildPictureFromPicHandle = (unsigned long (*)(PicHandle, Boolean)) CallResolver("REALBuildPictureFromPicHandle");
  428.     if (pBuildPictureFromPicHandle) return (REALpicture)pBuildPictureFromPicHandle(pic, bPassOwnership);
  429.     else return (REALpicture)0;
  430. }
  431. #endif
  432.  
  433. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  434. REALpicture REALBuildPictureFromGWorld(GWorldPtr world, Boolean bPassOwnership)
  435. {
  436.     static unsigned long (*pBuildPictureFromGWorld)(GWorldPtr, Boolean) = nil;
  437.     if (!pBuildPictureFromGWorld)
  438.         pBuildPictureFromGWorld = (unsigned long (*)(GWorldPtr, Boolean)) CallResolver("REALBuildPictureFromGWorld");
  439.     if (pBuildPictureFromGWorld) return (REALpicture)pBuildPictureFromGWorld(world, bPassOwnership);
  440.     else return (REALpicture)0;
  441. }
  442. #endif
  443.  
  444. REALpicture REALBuildPictureFromPictureDescription(REALpictureDescription *description, Boolean bPassOwnership)
  445. {
  446.     static unsigned long (*pBuildPictureFromPictureDescription)(REALpictureDescription *, Boolean) = nil;
  447.     if (!pBuildPictureFromPictureDescription)
  448.         pBuildPictureFromPictureDescription = (unsigned long (*)(REALpictureDescription *, Boolean)) CallResolver("REALBuildPictureFromPictureDescription");
  449.     if (pBuildPictureFromPictureDescription) return (REALpicture)pBuildPictureFromPictureDescription(description, bPassOwnership);
  450.     else return (REALpicture)0;
  451. }
  452.  
  453. void REALLockPictureDescription(REALpicture pic, REALpictureDescription *description)
  454. {
  455.     static void (*pLockPictureDescription)(REALpicture, REALpictureDescription *) = nil;
  456.     if (!pLockPictureDescription)
  457.         pLockPictureDescription = (void (*)(REALpicture, REALpictureDescription *)) CallResolver("lockPictureDescription");
  458.     if (pLockPictureDescription) pLockPictureDescription(pic, description);
  459. }
  460.  
  461. void REALUnlockPictureDescription(REALpicture pic)
  462. {
  463.     static void (*pUnlockPictureDescription)(REALpicture) = nil;
  464.     if (!pUnlockPictureDescription)
  465.         pUnlockPictureDescription = (void (*)(REALpicture)) CallResolver("unlockPictureDescription");
  466.     if (pUnlockPictureDescription) pUnlockPictureDescription(pic);
  467. }
  468.  
  469. void REALLockSoundDescription(REALsound sound, REALsoundDescription *description)
  470. {
  471.     static void (*pLockSoundDescription)(REALsound, REALsoundDescription *) = nil;
  472.     if (!pLockSoundDescription)
  473.         pLockSoundDescription = (void (*)(REALsound, REALsoundDescription *)) CallResolver("");
  474.     if (pLockSoundDescription) pLockSoundDescription(sound, description);
  475. }
  476.  
  477. void REALUnlockSoundDescription(REALsound sound)
  478. {
  479.     static void (*pUnlockSoundDescription)(REALsound) = nil;
  480.     if (!pUnlockSoundDescription)
  481.         pUnlockSoundDescription = (void (*)(REALsound)) CallResolver("unlockPictureDescription");
  482.     if (pUnlockSoundDescription) pUnlockSoundDescription(sound);
  483. }
  484.  
  485. void REALPictureClearCache(REALpicture pic)
  486. {
  487.     static void (*pPictureClearCache)(REALpicture) = nil;
  488.     if (!pPictureClearCache)
  489.         pPictureClearCache = (void (*)(REALpicture)) CallResolver("REALPictureClearCache");
  490.     if (pPictureClearCache) pPictureClearCache(pic);
  491. }
  492.  
  493. #if TARGET_WIN32
  494. void REALDrawPicturePrimitive(HDC hDC, REALpicture pic, const Rect *rBounds, int bTransparent)
  495. {
  496.     static void (*pDrawPicturePrimitive)(HDC, REALpicture, const Rect *, int) = nil;
  497.     if (!pDrawPicturePrimitive)
  498.         pDrawPicturePrimitive = (void (*)(HDC, REALpicture, const Rect *, int)) CallResolver("drawPicturePrimitive");
  499.     if (pDrawPicturePrimitive) pDrawPicturePrimitive(hDC, pic, rBounds, bTransparent);
  500. }
  501. #endif
  502.  
  503. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  504. void REALDrawPicturePrimitive(REALpicture pic, const Rect *rBounds, int bTransparent)
  505. {
  506.     static void (*pDrawPicturePrimitive)(REALpicture, const Rect *, int) = nil;
  507.     if (!pDrawPicturePrimitive)
  508.         pDrawPicturePrimitive = (void (*)(REALpicture, const Rect *, int)) CallResolver("drawPicturePrimitive");
  509.     if (pDrawPicturePrimitive) pDrawPicturePrimitive(pic, rBounds, bTransparent);
  510. }
  511. #endif
  512.  
  513. REALdbCursor REALdbCursorFromDBCursor(dbCursor *cursor, REALdbCursorDefinition *defn)
  514. {
  515.     static REALdbCursor (*pDbCursorFromDBCursor)(dbCursor *, REALdbCursorDefinition *) = nil;
  516.     if (!pDbCursorFromDBCursor)
  517.         pDbCursorFromDBCursor = (REALdbCursor (*)(dbCursor *, REALdbCursorDefinition *)) CallResolver("REALdbCursorFromDBCursor");
  518.     if (pDbCursorFromDBCursor) return pDbCursorFromDBCursor(cursor, defn);
  519.     else return (REALdbCursor)0;
  520. }
  521.  
  522. REALdbDatabase REALdbDatabaseFromDBDatabase(dbDatabase *database, REALdbEngineDefinition *defn)
  523. {
  524.     static REALdbDatabase (*pDbDatabaseFromDBDatabase)(dbDatabase *, REALdbEngineDefinition *) = nil;
  525.     if (!pDbDatabaseFromDBDatabase)
  526.         pDbDatabaseFromDBDatabase = (REALdbDatabase (*)(dbDatabase *, REALdbEngineDefinition *)) CallResolver("REALdbDatabaseFromDBDatabase");
  527.     if (pDbDatabaseFromDBDatabase) return pDbDatabaseFromDBDatabase(database, defn);
  528.     else return (REALdbDatabase)0;
  529. }
  530.  
  531. void *REALGetEventInstance(REALcontrolInstance instance, REALevent *event)
  532. {
  533.     static void *(*pGetEventInstance)(REALcontrolInstance instance, int builtHook);
  534.     #ifdef powerc
  535.     if (!pGetEventInstance)
  536.         pGetEventInstance = (void *(*)(REALcontrolInstance,int)) CallResolver("GetEventInstancePPC");
  537.     return (void *) pGetEventInstance(instance, event->forSystemUse);
  538.     #else
  539.     if (!pGetEventInstance)
  540.         pGetEventInstance = (void *(*)(REALcontrolInstance,int)) CallResolver("GetEventInstance");
  541.     return (void *) pGetEventInstance(instance, event->forSystemUse);
  542.     #endif
  543. }
  544.  
  545. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  546. void REALRegisterEventFilter(REALEventCallback callback, long param)
  547. {
  548.     static void (*pRegisterEventFilter)(REALEventCallback, long param);
  549.     #ifdef powerc
  550.     if (!pRegisterEventFilter)
  551.         pRegisterEventFilter = (void (*)(REALEventCallback, long)) CallResolver("PluginRegisterEventFilterPPC");
  552.     #else
  553.     if (!pRegisterEventFilter)
  554.         pRegisterEventFilter = (void (*)(REALEventCallback, long)) CallResolver("PluginRegisterEventFilter");
  555.     #endif
  556.     pRegisterEventFilter(callback, param);
  557. }
  558. #endif
  559.  
  560. void *REALGetControlData(REALcontrolInstance instance, REALcontrol *defn)
  561. {
  562.     return ((Ptr) instance) + defn->forSystemUse;
  563. }
  564.  
  565. void *REALGetClassData(REALobject instance, REALclassDefinition *defn)
  566. {
  567.     return ((Ptr) instance) + defn->forSystemUse;
  568. }
  569.  
  570. void REALGetControlBounds(REALcontrolInstance instance, Rect *rBounds)
  571. {
  572.     static void (*pGetControlBounds)(REALcontrolInstance, Rect *) = nil;
  573.     if (!pGetControlBounds)
  574.         pGetControlBounds = (void (*)(REALcontrolInstance, Rect *)) CallResolver("GetControlBounds");
  575.     if (pGetControlBounds) pGetControlBounds(instance, rBounds);
  576. }
  577.  
  578. long REALGetControlVisible(REALcontrolInstance instance)
  579. {
  580.     static long (*pGetControlVisible)(REALcontrolInstance) = nil;
  581.     if (!pGetControlVisible)
  582.         pGetControlVisible = (long (*)(REALcontrolInstance)) CallResolver("GetControlVisible");
  583.     if (pGetControlVisible) return pGetControlVisible(instance);
  584.     else return (long)0;
  585. }
  586.  
  587. Boolean REALGetControlEnabled(REALcontrolInstance instance)
  588. {
  589.     static int (*pGetControlEnabled)(REALcontrolInstance, long);
  590.     if (!pGetControlEnabled)
  591.         pGetControlEnabled = (int (*)(REALcontrolInstance, long)) CallResolver("controlEnabledGetter");
  592.     return (Boolean)pGetControlEnabled(instance, 0);
  593. }
  594.  
  595. void REALSetControlVisible(REALcontrolInstance instance, unsigned long visible)
  596. {
  597.     static void (*pSetControlVisible)(REALcontrolInstance, unsigned long) = nil;
  598.     if (!pSetControlVisible)
  599.         pSetControlVisible = (void (*)(REALcontrolInstance, unsigned long)) CallResolver("SetControlVisible");
  600.     if (pSetControlVisible) pSetControlVisible(instance, visible);
  601. }
  602.  
  603. REALgraphics REALGetControlGraphics(REALcontrolInstance instance)
  604. {
  605.     static unsigned long (*pGetControlGraphics)(REALcontrolInstance) = nil;
  606.     if (!pGetControlGraphics)
  607.         pGetControlGraphics = (unsigned long (*)(REALcontrolInstance)) CallResolver("REALGetControlGraphics");
  608.     if (pGetControlGraphics) return (REALgraphics)pGetControlGraphics(instance);
  609.     else return (REALgraphics)0;
  610. }
  611.  
  612. #if TARGET_WIN32
  613. int REALGetWin32Charset(void)
  614. {
  615.     static int (*pGetWin32Charset)(void) = nil;
  616.     if (!pGetWin32Charset)
  617.         pGetWin32Charset = (int (*)(void)) CallResolver("REALGetWin32Charset");
  618.     if (pGetWin32Charset) return pGetWin32Charset();
  619.     else return (int)0;
  620. }
  621. #endif
  622.  
  623. #if TARGET_WIN32
  624. REALfolderItem REALFolderItemFromPath(const char *path)
  625. {
  626.     static unsigned long (*pFolderItemFromPath)(const char *) = nil;
  627.     if (!pFolderItemFromPath)
  628.         pFolderItemFromPath = (unsigned long (*)(const char *)) CallResolver("FolderItemFromPath");
  629.     if (pFolderItemFromPath) return (REALfolderItem)pFolderItemFromPath(path);
  630.     else return (REALfolderItem)0;
  631. }
  632. #endif
  633.  
  634. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  635. REALfolderItem REALFolderItemFromFSSpec(const FSSpec *spec)
  636. {
  637.     static unsigned long (*pFolderItemFromFSSpec)(const FSSpec *) = nil;
  638.     if (!pFolderItemFromFSSpec)
  639.         pFolderItemFromFSSpec = (unsigned long (*)(const FSSpec *)) CallResolver("FolderItemFromFSSpec");
  640.     if (pFolderItemFromFSSpec) return (REALfolderItem)pFolderItemFromFSSpec(spec);
  641.     else return (REALfolderItem)0;
  642. }
  643. #endif
  644.  
  645. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  646. Boolean REALFSSpecFromFolderItem(FSSpec *spec, REALfolderItem item)
  647. {
  648.     static Boolean (*pFSSpecFromFolderItem)(FSSpec *, REALfolderItem) = nil;
  649.     if (!pFSSpecFromFolderItem)
  650.         pFSSpecFromFolderItem = (Boolean (*)(FSSpec *, REALfolderItem)) CallResolver("REALFSSpecFromFolderItem");
  651.     if (pFSSpecFromFolderItem) return pFSSpecFromFolderItem(spec, item);
  652.     else return (Boolean)0;
  653. }
  654. #endif
  655.  
  656. REALstring REALpathFromFolderItem(REALfolderItem item)
  657. {
  658.     static unsigned long (*pPathFromFolderItem)(REALfolderItem) = nil;
  659.     if (!pPathFromFolderItem)
  660.         pPathFromFolderItem = (unsigned long (*)(REALfolderItem)) CallResolver("REALpathFromFolderItem");
  661.     if (pPathFromFolderItem) return (REALstring)pPathFromFolderItem(item);
  662.     else return (REALstring)0;
  663. }
  664.  
  665. #if TARGET_WIN32
  666. HDC REALGraphicsDC(REALgraphics context)
  667. {
  668.     static unsigned long (*pGraphicsDC)(REALgraphics) = nil;
  669.     if (!pGraphicsDC)
  670.         pGraphicsDC = (unsigned long (*)(REALgraphics)) CallResolver("REALGraphicsDC");
  671.     if (pGraphicsDC) return (HDC)pGraphicsDC(context);
  672.     else return (HDC)0;
  673. }
  674. #endif
  675.  
  676. #if TARGET_WIN32
  677. HWND REALGetControlHWND(REALcontrolInstance control)
  678. {
  679.     static HWND (*pGetControlHWND)(REALcontrolInstance) = nil;
  680.     if (!pGetControlHWND)
  681.         pGetControlHWND = (HWND (*)(REALcontrolInstance)) CallResolver("GetControlHWND");
  682.     if (pGetControlHWND) return pGetControlHWND(control);
  683.     else return (HWND)0;
  684. }
  685. #endif
  686.  
  687. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  688. void REALSelectGraphics(REALgraphics context)
  689. {
  690.     static void (*pSelectGraphics)(REALgraphics) = nil;
  691.     if (!pSelectGraphics)
  692.         pSelectGraphics = (void (*)(REALgraphics)) CallResolver("SelectGraphics");
  693.     if (pSelectGraphics) pSelectGraphics(context);
  694. }
  695. #endif
  696.  
  697. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  698. void REALGraphicsDrawOffscreenMacControl(REALgraphics context, ControlHandle mh)
  699. {
  700.     static void (*pGraphicsDrawOffscreenMacControl)(REALgraphics, ControlHandle) = nil;
  701.     if (!pGraphicsDrawOffscreenMacControl)
  702.         pGraphicsDrawOffscreenMacControl = (void (*)(REALgraphics, ControlHandle)) CallResolver("DrawOffscreenMacControl");
  703.     if (pGraphicsDrawOffscreenMacControl) pGraphicsDrawOffscreenMacControl(context, mh);
  704. }
  705. #endif
  706.  
  707. void REALInvalidateControl(REALcontrolInstance instance)
  708. {
  709.     static void (*pInvalidateControl)(REALcontrolInstance) = nil;
  710.     if (!pInvalidateControl)
  711.         pInvalidateControl = (void (*)(REALcontrolInstance)) CallResolver("REALInvalidateControl");
  712.     if (pInvalidateControl) pInvalidateControl(instance);
  713. }
  714.  
  715. void REALInvalidateControlRect(REALcontrolInstance instance, int left, int top, int right, int bottom)
  716. {
  717.     static void (*pInvalidateControlRect)(REALcontrolInstance, int, int, int, int) = nil;
  718.     if (!pInvalidateControlRect)
  719.         pInvalidateControlRect = (void (*)(REALcontrolInstance, int, int, int, int)) CallResolver("REALInvalidateControlRect");
  720.     if (pInvalidateControlRect) pInvalidateControlRect(instance, left, top, right, bottom);
  721. }
  722.  
  723. #if TARGET_WIN32
  724. void REALSetSpecialBackground(REALcontrolInstance instance, COLORREF *pcolor)
  725. {
  726.     static void (*pSetSpecialBackground)(REALcontrolInstance, COLORREF *) = nil;
  727.     if (!pSetSpecialBackground)
  728.         pSetSpecialBackground = (void (*)(REALcontrolInstance, COLORREF *)) CallResolver("REALSetSpecialBackground");
  729.     if (pSetSpecialBackground) pSetSpecialBackground(instance, pcolor);
  730. }
  731. #endif
  732.  
  733. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  734. void REALSetSpecialBackground(REALcontrolInstance instance)
  735. {
  736.     static void (*pSetSpecialBackground)(REALcontrolInstance) = nil;
  737.     if (!pSetSpecialBackground)
  738.         pSetSpecialBackground = (void (*)(REALcontrolInstance)) CallResolver("REALSetSpecialBackground");
  739.     if (pSetSpecialBackground) pSetSpecialBackground(instance);
  740. }
  741. #endif
  742.  
  743. REALwindow REALGetControlWindow(REALcontrolInstance instance)
  744. {
  745.     static REALwindow (*pGetControlWindow)(REALcontrolInstance) = nil;
  746.     if (!pGetControlWindow)
  747.         pGetControlWindow = (REALwindow (*)(REALcontrolInstance)) CallResolver("getControlWindow");
  748.     if (pGetControlWindow) return pGetControlWindow(instance);
  749.     else return (REALwindow)0;
  750. }
  751.  
  752. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  753. REALsound REALBuildSoundFromHandle(Handle sound, Boolean bPassOwnership)
  754. {
  755.     static REALsound (*pBuildSoundFromHandle)(Handle, Boolean) = nil;
  756.     if (!pBuildSoundFromHandle)
  757.         pBuildSoundFromHandle = (REALsound (*)(Handle, Boolean)) CallResolver("REALBuildSoundFromHandle");
  758.     if (pBuildSoundFromHandle) return pBuildSoundFromHandle(sound, bPassOwnership);
  759.     else return (REALsound)0;
  760. }
  761. #endif
  762.  
  763. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  764. REALappleEvent REALBuildAppleEvent(const AppleEvent *event, Boolean bPassOwnership)
  765. {
  766.     static unsigned long (*pBuildAppleEvent)(const AppleEvent *, Boolean) = nil;
  767.     if (!pBuildAppleEvent)
  768.         pBuildAppleEvent = (unsigned long (*)(const AppleEvent *, Boolean)) CallResolver("REALBuildAppleEvent");
  769.     if (pBuildAppleEvent) return (REALappleEvent)pBuildAppleEvent(event, bPassOwnership);
  770.     else return (REALappleEvent)0;
  771. }
  772. #endif
  773.  
  774. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  775. REALappleEvent REALBuildAEDescList(const AppleEvent *event, Boolean bPassOwnership)
  776. {
  777.     static unsigned long (*pBuildAEDescList)(const AppleEvent *, Boolean) = nil;
  778.     if (!pBuildAEDescList)
  779.         pBuildAEDescList = (unsigned long (*)(const AppleEvent *, Boolean)) CallResolver("REALBuildAEDescList");
  780.     if (pBuildAEDescList) return (REALappleEvent)pBuildAEDescList(event, bPassOwnership);
  781.     else return (REALappleEvent)0;
  782. }
  783. #endif
  784.  
  785. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  786. REALappleEvent REALBuildAEObjSpecifier(const AppleEvent *event, Boolean bPassOwnership)
  787. {
  788.     static unsigned long (*pBuildAEObjSpecifier)(const AppleEvent *, Boolean) = nil;
  789.     if (!pBuildAEObjSpecifier)
  790.         pBuildAEObjSpecifier = (unsigned long (*)(const AppleEvent *, Boolean)) CallResolver("REALBuildAEObjSpecifier");
  791.     if (pBuildAEObjSpecifier) return (REALappleEvent)pBuildAEObjSpecifier(event, bPassOwnership);
  792.     else return (REALappleEvent)0;
  793. }
  794. #endif
  795.  
  796. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  797. AppleEvent *REALAccessAppleEvent(REALappleEvent event)
  798. {
  799.     static unsigned long (*pAccessAppleEvent)(REALappleEvent) = nil;
  800.     if (!pAccessAppleEvent)
  801.         pAccessAppleEvent = (unsigned long (*)(REALappleEvent)) CallResolver("REALAccessAppleEvent");
  802.     if (pAccessAppleEvent) return (AppleEvent *)pAccessAppleEvent(event);
  803.     else return (AppleEvent *)0;
  804. }
  805. #endif
  806.  
  807. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  808. AppleEvent *REALAccessAppleEventReply(REALappleEvent event)
  809. {
  810.     static unsigned long (*pAccessAppleEventReply)(REALappleEvent) = nil;
  811.     if (!pAccessAppleEventReply)
  812.         pAccessAppleEventReply = (unsigned long (*)(REALappleEvent)) CallResolver("REALAccessAppleEventReply");
  813.     if (pAccessAppleEventReply) return (AppleEvent *)pAccessAppleEventReply(event);
  814.     else return (AppleEvent *)0;
  815. }
  816. #endif
  817.  
  818. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  819. WindowPtr REALGetWindowHandle(REALwindow window)
  820. {
  821.     static unsigned long (*pGetWindowHandle)(REALwindow) = nil;
  822.     if (!pGetWindowHandle)
  823.         pGetWindowHandle = (unsigned long (*)(REALwindow)) CallResolver("REALGetWindowHandle");
  824.     if (pGetWindowHandle) return (WindowPtr)pGetWindowHandle(window);
  825.     else return (WindowPtr)0;
  826. }
  827. #endif
  828.  
  829. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  830. ControlHandle REALGetControlHandle(REALcontrolInstance control)
  831. {
  832.     static unsigned long (*pGetControlHandle)(REALcontrolInstance) = nil;
  833.     if (!pGetControlHandle)
  834.         pGetControlHandle = (unsigned long (*)(REALcontrolInstance)) CallResolver("REALGetControlHandle");
  835.     if (pGetControlHandle) return (ControlHandle)pGetControlHandle(control);
  836.     else return (ControlHandle)0;
  837. }
  838. #endif
  839.  
  840. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  841. MenuHandle REALGetPopupMenuHandle(REALpopupMenu popup)
  842. {
  843.     static unsigned long (*pGetPopupMenuHandle)(REALpopupMenu) = nil;
  844.     if (!pGetPopupMenuHandle)
  845.         pGetPopupMenuHandle = (unsigned long (*)(REALpopupMenu)) CallResolver("REALGetPopupMenuHandle");
  846.     if (pGetPopupMenuHandle) return (MenuHandle)pGetPopupMenuHandle(popup);
  847.     else return (MenuHandle)0;
  848. }
  849. #endif
  850.  
  851. MovieController REALgetMoviePlayerController(REALmoviePlayer instance)
  852. {
  853.     static unsigned long (*pGetMoviePlayerController)(REALmoviePlayer) = nil;
  854.     if (!pGetMoviePlayerController)
  855.         pGetMoviePlayerController = (unsigned long (*)(REALmoviePlayer)) CallResolver("getMoviePlayerController");
  856.     if (pGetMoviePlayerController) return (MovieController)pGetMoviePlayerController(instance);
  857.     else return (MovieController)0;
  858. }
  859.  
  860. Movie REALgetMovieMovie(REALmovie instance)
  861. {
  862.     static unsigned long (*pGetMovieMovie)(REALmovie) = nil;
  863.     if (!pGetMovieMovie)
  864.         pGetMovieMovie = (unsigned long (*)(REALmovie)) CallResolver("getMovieMovie");
  865.     if (pGetMovieMovie) return (Movie)pGetMovieMovie(instance);
  866.     else return (Movie)0;
  867. }
  868.  
  869. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  870. REALmovie REALbuildMovie(Movie movie, int resRefNum, int bNew)
  871. {
  872.     static unsigned long (*pBuildMovie)(Movie, int, int) = nil;
  873.     if (!pBuildMovie)
  874.         pBuildMovie = (unsigned long (*)(Movie, int, int)) CallResolver("buildMovie");
  875.     if (pBuildMovie) return (REALmovie)pBuildMovie(movie, resRefNum, bNew);
  876.     else return (REALmovie)0;
  877. }
  878. #endif
  879.  
  880. #if TARGET_68K || TARGET_PPC || TARGET_CARBON
  881. void REALmarkMovieDirty(REALmovie movie)
  882. {
  883.     static void (*pMarkMovieDirty)(REALmovie) = nil;
  884.     if (!pMarkMovieDirty)
  885.         pMarkMovieDirty = (void (*)(REALmovie)) CallResolver("markMovieDirty");
  886.     if (pMarkMovieDirty) pMarkMovieDirty(movie);
  887. }
  888. #endif
  889.  
  890. int REALenterMovies(void)
  891. {
  892.     static int (*pEnterMovies)(void) = nil;
  893.     if (!pEnterMovies)
  894.         pEnterMovies = (int (*)(void)) CallResolver("REALenterMovies");
  895.     if (pEnterMovies) return pEnterMovies();
  896.     else return (int)0;
  897. }
  898.  
  899. REALobject REALnewInstance(const char *className)
  900. {
  901.     static unsigned long (*pNewInstance)(const char *) = nil;
  902.     if (!pNewInstance)
  903.         pNewInstance = (unsigned long (*)(const char *)) CallResolver("PluginNewInstance");
  904.     if (pNewInstance) return (REALobject)pNewInstance(className);
  905.     else return (REALobject)0;
  906. }
  907.  
  908. REALobject REALnewMemoryBlock(long sz)
  909. {
  910.     static unsigned long (*pNewInstance)(long) = nil;
  911.     if (!pNewInstance)
  912.         pNewInstance = (unsigned long (*)(long))CallResolver("newMemoryBlock");
  913.     if (pNewInstance) return (REALobject)pNewInstance(sz);
  914.     else return (REALobject)0;
  915. }
  916.  
  917. void REALMarkSocketUsage(void)
  918. {
  919.     static void (*pMarkSocketUsage)(void) = nil;
  920.     if (!pMarkSocketUsage)
  921.         pMarkSocketUsage = (void (*)(void)) CallResolver("PluginMarkSocketUsage");
  922.     if (pMarkSocketUsage) pMarkSocketUsage();
  923. }
  924.  
  925. void REALSocketConnect(REALsocket socket, REALstring address, int port)
  926. {
  927.     static void (*pSocketConnect)(REALsocket, REALstring, int) = nil;
  928.     if (!pSocketConnect)
  929.         pSocketConnect = (void (*)(REALsocket, REALstring, int)) CallResolver("");
  930.     if (pSocketConnect) pSocketConnect(socket, address, port);
  931. }
  932.  
  933. void REALSocketClose(REALsocket socket)
  934. {
  935.     static void (*pSocketClose)(REALsocket) = nil;
  936.     if (!pSocketClose)
  937.         pSocketClose = (void (*)(REALsocket)) CallResolver("socketClose");
  938.     if (pSocketClose) pSocketClose(socket);
  939. }
  940.  
  941. REALstring REALSocketReadAll(REALsocket socket)
  942. {
  943.     static unsigned long (*pSocketReadAll)(REALsocket) = nil;
  944.     if (!pSocketReadAll)
  945.         pSocketReadAll = (unsigned long (*)(REALsocket)) CallResolver("pluginSocketReadAll");
  946.     if (pSocketReadAll) return (REALstring)pSocketReadAll(socket);
  947.     else return (REALstring)0;
  948. }
  949.  
  950. REALstring REALSocketRead(REALsocket socket, int count)
  951. {
  952.     static unsigned long (*pSocketRead)(REALsocket, int) = nil;
  953.     if (!pSocketRead)
  954.         pSocketRead = (unsigned long (*)(REALsocket, int)) CallResolver("pluginSocketRead");
  955.     if (pSocketRead) return (REALstring)pSocketRead(socket, count);
  956.     else return (REALstring)0;
  957. }
  958.  
  959. void REALSocketWrite(REALsocket socket, REALstring data)
  960. {
  961.     static void (*pSocketWrite)(REALsocket, REALstring) = nil;
  962.     if (!pSocketWrite)
  963.         pSocketWrite = (void (*)(REALsocket, REALstring)) CallResolver("SocketWrite");
  964.     if (pSocketWrite) pSocketWrite(socket, data);
  965. }
  966.  
  967. int REALSocketLastErrorCode(REALsocket socket, int unused)
  968. {
  969.     static int (*pSocketLastErrorCode)(REALsocket, int) = nil;
  970.     if (!pSocketLastErrorCode)
  971.         pSocketLastErrorCode = (int (*)(REALsocket, int)) CallResolver("socketLastErrorCode");
  972.     if (pSocketLastErrorCode) return pSocketLastErrorCode(socket, unused);
  973.     else return (int)0;
  974. }
  975.  
  976. REALstring REALSocketLookahead(REALsocket socket, int unused)
  977. {
  978.     static unsigned long (*pSocketLookahead)(REALsocket, int) = nil;
  979.     if (!pSocketLookahead)
  980.         pSocketLookahead = (unsigned long (*)(REALsocket, int)) CallResolver("pluginSocketLookahead");
  981.     if (pSocketLookahead) return (REALstring)pSocketLookahead(socket, unused);
  982.     else return (REALstring)0;
  983. }
  984.  
  985. REALstring REALSocketLocalAddressGetter(REALsocket socket, int unused)
  986. { if (unused){};
  987.     static REALstring (*pSocketLocalAddressGetter)(REALsocket, int);
  988.     if (!pSocketLocalAddressGetter)
  989.         pSocketLocalAddressGetter = (REALstring (*)(REALsocket, int)) CallResolver("socketLookahead");
  990.     return pSocketLocalAddressGetter(socket, 0);
  991. }
  992.  
  993. void REALSocketPoll(REALsocket socket)
  994. {
  995.     static void (*pSocketPoll)(REALsocket) = nil;
  996.     if (!pSocketPoll)
  997.         pSocketPoll = (void (*)(REALsocket)) CallResolver("socketPoll");
  998.     if (pSocketPoll) pSocketPoll(socket);
  999. }
  1000.  
  1001. int REALSocketGetEvents(REALsocket socket, int unused)
  1002. {
  1003.     static int (*pSocketGetEvents)(REALsocket, int) = nil;
  1004.     if (!pSocketGetEvents)
  1005.         pSocketGetEvents = (int (*)(REALsocket, int)) CallResolver("socketGetEvents");
  1006.     if (pSocketGetEvents) return pSocketGetEvents(socket, unused);
  1007.     else return (int)0;
  1008. }
  1009.  
  1010. void REALRegisterDataSourceInterface(const char *szMenuName, REALDataSourceInterfaceProc proc)
  1011. {
  1012.     static void (*pRegisterDataSourceInterface)(const char *, REALDataSourceInterfaceProc) = nil;
  1013.     if (!pRegisterDataSourceInterface)
  1014.         pRegisterDataSourceInterface = (void (*)(const char *, REALDataSourceInterfaceProc)) CallResolver("RegisterDataSourceInterface");
  1015.     if (pRegisterDataSourceInterface)
  1016.     #ifdef USECALLSHELL
  1017.         pRegisterDataSourceInterface(szMenuName, buildEnvironmentShell(proc));
  1018.     #else
  1019.         pRegisterDataSourceInterface(szMenuName, proc);
  1020.     #endif
  1021. }
  1022.  
  1023. void REALRegisterDataSource(const char *szDatasourceName, REALDataSourceProc proc)
  1024. {
  1025.     static void (*pRegisterDataSource)(const char *, REALDataSourceProc);
  1026.     if (!pRegisterDataSource)
  1027.         pRegisterDataSource = (void (*)(const char *, REALDataSourceProc)) CallResolver("RegisterDataSource");
  1028.     #ifdef USECALLSHELL
  1029.     pRegisterDataSource(szDatasourceName, (REALDataSourceProc) buildEnvironmentShell(proc));
  1030.     #else
  1031.     pRegisterDataSource(szDatasourceName, proc);
  1032.     #endif
  1033. }
  1034.  
  1035. void REALDesignAddDataSource(const char *baseName, const char *szDataSourceName, Ptr data, int dataLen)
  1036. {
  1037.     static void (*pDesignAddDataSource)(const char *, const char *, Ptr, int) = nil;
  1038.     if (!pDesignAddDataSource)
  1039.         pDesignAddDataSource = (void (*)(const char *, const char *, Ptr, int)) CallResolver("DesignAddDataSource");
  1040.     if (pDesignAddDataSource) pDesignAddDataSource(baseName, szDataSourceName, data, dataLen);
  1041. }
  1042.  
  1043. void REALMessageBox(REALstring text)
  1044. {
  1045.     static void (*pMessageBox)(REALstring) = nil;
  1046.     if (!pMessageBox)
  1047.         pMessageBox = (void (*)(REALstring)) CallResolver("RuntimeMsgBox");
  1048.     if (pMessageBox) pMessageBox(text);
  1049. }
  1050.  
  1051. #if TARGET_WIN32
  1052. REALpicture REALBuildPictureFromDIB(HANDLE hDIB, Boolean bPassOwnership)
  1053. {
  1054.     static unsigned long (*pBuildPictureFromDIB)(HANDLE, Boolean) = nil;
  1055.     if (!pBuildPictureFromDIB)
  1056.         pBuildPictureFromDIB = (unsigned long (*)(HANDLE, Boolean)) CallResolver("REALBuildPictureFromDIB");
  1057.     if (pBuildPictureFromDIB) return (REALpicture)pBuildPictureFromDIB(hDIB, bPassOwnership);
  1058.     else return (REALpicture)0;
  1059. }
  1060. #endif
  1061.  
  1062. void REALSetControlEnabled(REALcontrolInstance instance, long unused, Boolean enable)
  1063. {
  1064.     static void (*pSetControlEnabled)(REALcontrolInstance, long, Boolean) = nil;
  1065.     if (!pSetControlEnabled)
  1066.         pSetControlEnabled = (void (*)(REALcontrolInstance, long, Boolean)) CallResolver("controlEnabledSetter");
  1067.     if (pSetControlEnabled) pSetControlEnabled(instance, unused, enable);
  1068. }
  1069.  
  1070. long REALGetControlPosition(REALcontrolInstance instance, long which)
  1071. {
  1072.     static unsigned long (*pGetControlPosition)(REALcontrolInstance, long) = nil;
  1073.     if (!pGetControlPosition)
  1074.         pGetControlPosition = (unsigned long (*)(REALcontrolInstance, long)) CallResolver("ctlPosGetter");
  1075.     if (pGetControlPosition) return (long)pGetControlPosition(instance, which);
  1076.     else return (long)0;
  1077. }
  1078.  
  1079. void REALSetControlPosition(REALcontrolInstance instance, long which, long value)
  1080. {
  1081.     static void (*pSetControlPosition)(REALcontrolInstance, long, long) = nil;
  1082.     if (!pSetControlPosition)
  1083.         pSetControlPosition = (void (*)(REALcontrolInstance, long, long)) CallResolver("ctlPosSetter");
  1084.     if (pSetControlPosition) pSetControlPosition(instance, which, value);
  1085. }
  1086.  
  1087. // **** Autogenerated code from Plugin API Manager ends here ****
  1088. // **************** Do not edit above this line *****************
  1089. #pragma mark -
  1090. #pragma mark PAM Code Above!
  1091. #pragma mark -
  1092.  
  1093. long REALstringToOSType(REALstring id)
  1094. {
  1095.     long rv = '    ';
  1096.     int count = id->Length();
  1097.     if (count > 4)
  1098.         count = 4;
  1099.     BlockMove(id->CString(), &rv, count);
  1100.     return rv;
  1101. }
  1102.  
  1103. #ifdef powerc
  1104. extern "C" {
  1105. void __sinit(void);    /*    (generated by linker)    */
  1106. }
  1107. #endif
  1108.  
  1109. #ifdef WIN32
  1110.  
  1111. extern "C" {
  1112. void __declspec(dllexport) REALPluginMain(void *(*resolver)(const char *entryName));
  1113. }
  1114.  
  1115. void __declspec(dllexport) REALPluginMain(void *(*resolver)(const char *entryName))
  1116. #else
  1117. void main(void *(*resolver)(const char *entryName))
  1118. #endif
  1119. {
  1120. //    void (*pRegisterPluginExports)(REALexport *table);
  1121.     void (*pRegisterPluginVersion)(int version);
  1122.  
  1123. #ifndef WIN32
  1124.  #if !CARBON    // May 03 2000 -- GCC (1)
  1125.     EnterCodeResource();
  1126.  #endif            // May 03 2000 -- GCC (1)
  1127. #endif
  1128.  
  1129. #ifdef powerc
  1130.     __sinit();
  1131. #endif
  1132.  
  1133.     gResolver = resolver;
  1134.  
  1135. #ifdef USECALLSHELL
  1136.     unsigned long (*getA4stack)(void);
  1137.  
  1138.     getA4stack = (unsigned long(*)(void)) resolver("getA4stackReference");
  1139.     a4stack = getA4stack();
  1140. #else
  1141. #ifndef WIN32 
  1142.  #if CARBON        // May 03 2000 -- GCC (1) -- Start
  1143.      gResolverPPC = (void *(*)(const char *)) gResolver("ResolverPPC");
  1144.  #else             // May 03 2000 -- GCC (1) -- End
  1145.     gResolverPPC = (void *(*)(const char *)) CallUniversalProc((RoutineDescriptor *) gResolver, kThinkCStackBased | RESULT_SIZE(SIZE_CODE(4)) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(4)), "ResolverPPC");
  1146.  #endif         // May 03 2000 -- GCC (1)
  1147. #endif
  1148. #endif
  1149.  
  1150. //    pRegisterPluginExports = (void (*)(REALexport *)) CallResolver("RegisterPluginExports");
  1151. //    pRegisterPluginExports(pluginExports);
  1152.  
  1153.     pRegisterPluginVersion = (void (*)(int)) CallResolver("RegisterPluginVersion");
  1154.     pRegisterPluginVersion(kCurrentREALControlVersion);
  1155.  
  1156.     PluginEntry();
  1157.  
  1158. #ifndef WIN32
  1159.  #if !CARBON    // May 03 2000 -- GCC (1)
  1160.     ExitCodeResource();
  1161.  #endif            // May 03 2000 -- GCC (1)
  1162. #endif
  1163. }
  1164.  
  1165. long REALstringStruct::Length(void)
  1166. {
  1167.     if (this)
  1168.         return mPrivateLength;
  1169.     else
  1170.         return 0;
  1171. }
  1172.  
  1173. const char *REALstringStruct::CString()
  1174. {
  1175.     if (this)
  1176.         return (const char *) (mPrivateStringData + 1);
  1177.     else
  1178.         return "";
  1179. }
  1180.  
  1181. const unsigned char *REALstringStruct::PString()
  1182. {
  1183.     if (this)
  1184.         return mPrivateStringData;
  1185.     else
  1186.         return "\p";
  1187. }
  1188.